package com.dc.zuul.responsibility.impl;

import com.dc.zuul.responsibility.GatewayHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author: KEYD
 * @Date: 2020/1/19 11:36
 * @Desc: 黑名单的拦截判断
 */
@Component
@Slf4j
public class BlackListHandler implements GatewayHandler {
    private GatewayHandler nextGatewayHandler;

    @Override
    public boolean service() {
        log.info("<<<<<<<<<<<<<<流程 1 判断，黑名单拦截>>>>>>>>>");
        //正确
        if (true) {
            return false; //不会往下继续执行
        }
        //错误
        nextGatewayHandler.service();
        return true;
    }

    @Override
    public void setNextHandler(GatewayHandler nextGatewayHandler) {
        this.nextGatewayHandler = nextGatewayHandler;
    }
}
